package com.ourteam.system.domain;

import net.dao.IDataPopulateCallback;

import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.lang.ArrayUtils;

import java.util.HashMap;

/**
 * Template Name : DTO数据对象
 * Template Version : 1
 * Template Last Modfiy Date : Thu Jul 12 16:34:06 CST 2018
 * Auto Generate Date : 2018-07-20 12:05:13
  * Warning ! This file will be overwrite when regenerate !
  *
 */
import java.util.Map;


public class SysUserPhotoBean implements java.io.Serializable {
    private static Map<String, String> mappedDaoFields = new HashMap<String, String>();

    static {
        mappedDaoFields.put("id", com.ourteam.system.dao.ISysUserPhotoDAO.Id);

        mappedDaoFields.put("userId",
            com.ourteam.system.dao.ISysUserPhotoDAO.UserId);

        mappedDaoFields.put("userPhoto",
            com.ourteam.system.dao.ISysUserPhotoDAO.UserPhoto);
    }

    private com.ourteam.system.dao.SysUserPhoto sysUserPhoto;

    public SysUserPhotoBean() {
        super();

        this.sysUserPhoto = new com.ourteam.system.dao.SysUserPhoto();
    }

    public SysUserPhotoBean(com.ourteam.system.dao.SysUserPhoto sysUserPhoto) {
        super();

        this.sysUserPhoto = sysUserPhoto;
    }

    protected BeanMap getBeanMap() {
        return new BeanMap(sysUserPhoto);
    }

    public static String getMappedDAOField(String aAttrName) {
        return mappedDaoFields.get(aAttrName);
    }

    public com.ourteam.system.dao.SysUserPhoto convertToSysUserPhoto() {
        return this.sysUserPhoto;
    }

    public com.ourteam.system.dao.SysUserPhoto convertTo() {
        return this.sysUserPhoto;
    }

    /**
     * Get id
     *
     * @return long
     */
    public long getId() {
        return (long) this.sysUserPhoto.getId();
    }

    /**
     * Set id
     *
     * @parameter long
     */
    public void setId(long id) {
        this.sysUserPhoto.setId(id);
    }

    /**
     * Get userId
     *
     * @return long
     */
    public long getUserId() {
        return (long) this.sysUserPhoto.getUserId();
    }

    /**
     * Set userId
     *
     * @parameter long
     */
    public void setUserId(long userId) {
        this.sysUserPhoto.setUserId(userId);
    }

    /**
     * Get userPhoto
     *
     * @return String
     */
    public String getUserPhoto() {
        return (String) this.sysUserPhoto.getUserPhoto();
    }

    /**
     * Set userPhoto
     *
     * @parameter String
     */
    public void setUserPhoto(String userPhoto) {
        this.sysUserPhoto.setUserPhoto(userPhoto);
    }

    public int hashCode() {
        return org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(this);
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        } // end if

        if ((obj instanceof SysUserPhotoBean) == false) {
            return false;
        } // end if

        SysUserPhotoBean other = (SysUserPhotoBean) obj;

        boolean isEqual = false;

        com.ourteam.system.dao.SysUserPhoto tempSysUserPhoto = other.convertToSysUserPhoto();

        if ((tempSysUserPhoto == null) || (this.sysUserPhoto == null)) {
            isEqual = false;
        } else if ((tempSysUserPhoto == this.sysUserPhoto) ||
                tempSysUserPhoto.equals(this.sysUserPhoto)) {
            isEqual = true;
        } else {
            isEqual = false;
        }

        return isEqual;
    }

    public static SysUserPhotoBean[] toArray(
        com.ourteam.system.dao.SysUserPhoto[] aSysUserPhotos) {
        return toArray(aSysUserPhotos, null);
    }

    public static SysUserPhotoBean[] toArray(
        com.ourteam.system.dao.SysUserPhoto[] aSysUserPhotos,
        IDataPopulateCallback aCallBack) {
        if (ArrayUtils.isEmpty(aSysUserPhotos)) {
            return new SysUserPhotoBean[0];
        }

        int length = aSysUserPhotos.length;

        SysUserPhotoBean[] beans = new SysUserPhotoBean[length];

        for (int i = 0; i < length; i++) {
            beans[i] = new SysUserPhotoBean(aSysUserPhotos[i]);

            if (aCallBack != null) {
                aCallBack.populate(beans[i], new Object[] { aSysUserPhotos[i] });
            }
        }

        return beans;
    }
}
